import type { Threat } from '@/types/threat'

const generateRandomIp = () => {
  return Array(4).fill(0).map(() => Math.floor(Math.random() * 256)).join('.')
}

const generateSparklineData = () => {
  return Array(20).fill(0).map(() => Math.floor(Math.random() * 100))
}

export const generateMockThreats = (count: number): Threat[] => {
  return Array(count).fill(0).map((_, index) => ({
    id: `threat${index + 1}`,
    sensor: 'bitvernica',
    events: Math.floor(Math.random() * 5000),
    severity: ['high', 'medium', 'low'][Math.floor(Math.random() * 3)] as 'high' | 'medium' | 'low',
    firstSeen: new Date(Date.now() - Math.random() * 86400000).toISOString(),
    lastSeen: new Date().toISOString(),
    sparkline: generateSparklineData(),
    srcIp: generateRandomIp(),
    srcPort: Math.floor(Math.random() * 65535),
    dstIp: generateRandomIp(),
    dstPort: Math.floor(Math.random() * 65535),
    protocol: Math.random() > 0.5 ? 'TCP' : 'UDP',
    type: ['malware', 'phishing', 'ddos'][Math.floor(Math.random() * 3)],
    trail: `example${index}.com`,
    info: `Threat information ${index}`,
    reference: `REF-${index}`,
    tags: ['static', 'malware', 'suspicious'].sort(() => Math.random() - 0.5).slice(0, 2)
  }))
} 